#pragma once
//============================================================================
// Copyright (C) 2013 Brett R. Jones
//
// Issued to public domain 2013
//
// brettjones1900@gmail.com
// http://www.p2panarchy.com
//============================================================================
#include "VxDefs.h"
#include <stdio.h>
#include <string>

#define FILE_XFER_OK							0x0001
#define FILE_XFER_ERR_ALREADY_DOWNLOADING		0x0002
#define FILE_XFER_ERR_ALREADY_DOWNLOADED		0x0004
#define FILE_XFER_ERR_FAILED_TO_CREATE			0x0008
#define FILE_XFER_ERR_BUSY						0x0010
#define FILE_XFER_ERR_FILE_NOT_FOUND			0x0020
#define FILE_XFER_ERR_PERMISSION				0x0040

// class for file transfer state
class VxFileXferInfo
{
public:
	//=== vars ===//
	U64			m_u64FileOffs;					// current offset into file we are at
	U64			m_u64FileLen;					// total file length
	FILE *		m_hFile;						// handle to file
	U32			m_u32RxFileInstanceId;
	U32			m_u32TxFileInstanceId;
	std::string	m_strRemoteFileName;			// remote file name
	std::string m_strLocalFileName;				// local file name
	std::string	m_strUserName;

	//=== constructor ===//
	VxFileXferInfo();

	//=== destructor ===//
	virtual ~VxFileXferInfo();

	float calcProgress( void ) { if(0 == m_u64FileOffs) return 0; return (float)((m_u64FileLen * 1000) / m_u64FileOffs)  / 10.0f; };
};
